﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using RoboTrocity;

namespace RoboTrocity {
	public class CollisionBox {
		public enum BoxType { NEUTRAL, HIT, ATTACK };
		//hit = where to damage, attack = this box damages stuff, neutral = basic bounding box
		
		int x, y; //polar coordinates
		int width, height;
		BoxType type;

		public CollisionBox(): 
			this(0,0,0,0){}

		public CollisionBox(Sprite _refSprite, BoxType _type) : //this just used the sprite's bounding box
			this(0, 0, _refSprite.Width, _refSprite.Height, _type){}

		public CollisionBox(int _x, int _y, int _width, int _height):
			this(_x, _y, _width, _height, BoxType.NEUTRAL){	}

		public CollisionBox(int _x, int _y, int _width, int _height, BoxType _type){
			x = _x; y = _y; width = _width; height = _height; type = _type;
		}

		public bool IntersectsWith(CollisionBox otherBox) {
			return ((Left <= otherBox.Right) && (Right >= otherBox.Left)
				&& (Top <= otherBox.Bottom) && (Bottom >= otherBox.Top));
		}

		public int X {
			get { return x; }
			set { x = value; }
		}

		public int Y {
			get { return y; }
			set { y = value; }
		}

		public int Width {
			get { return width; }
			set { width = value; }
		}
		
		public int Height {
			get { return height; }
			set { height = value; }
		}

		public int Top {
			get { return Y; }
		}

		public int Bottom {
			get { return Y + Height; }
		}

		public int Left {
			get { return X; }
		}

		public int Right {
			get { return X + Width; }
		}

		public BoxType Type {
			get { return type; }
			set { type = value; }
		}
	}
}
